import request from '@/common/request.js'
import obj from '@/common/config.js'
//通航信息-查询
export function getNavigation(query) {
	return request({
		url: '/business/pub/api/navigation',
		method: 'get',
		params: query
	})
}


// 咨询留言-新增/编辑
export function postMessage(data) {
	return request({
		url: '/business/pub/api/message/edit',
		method: 'post',
		data
	})
}
//收费/限重信息
export function getConfig(query) {
	return request({
		url: '/business/pub/api/config',
		method: 'get',
		params: query
	})
}

//常见问题-查询
export function getQuestion(query) {
	return request({
		url: '/business/pub/api/question/list',
		method: 'get',
		params: query
	})
}
//上传
// export function uploadList(query) {
//   return request({
//     url: '/business/file/upload',
//     method: 'get',
//     data: query
//   })
// }

export function uploadImageServer(filePath, successc, failc) {
	uni.uploadFile({
		url: obj.baseUrl + '/business/file/upload/inner', //  服务器 url  
		filePath: filePath,
		name: 'file',
		formData: {

		},
		success: function(res) {
			
			const {
				url,
				msg
			} = JSON.parse(res.data)
			if (res.statusCode !== 200) {
				failc(new Error('上传错误:' + JSON.stringify(msg)))

				return
			}
			successc(url)

		},
		fail: function(err) {
			console.log('.........')
			failc(err)
		}
	});


}
